from tkinter import *

def cb():
    print('variable is',var.get())

master = Tk()

var = StringVar()
var.set('T')

a = Checkbutton(master,text='男',
                variable=var,
                onvalue='T',offvalue='F',
                command=cb)
a.pack()



mainloop()


